﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 玩具商城管理系统.start
{
    public partial class Person : Form
    {
        public Person()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void Person_Load(object sender, EventArgs e)
        {
            DB.GetCn();
            string str = "select *from employee where employee_name='" + login.username + "'";
            DataTable dt = DB.GetDataSet(str); 
            txtId.Text = dt.Rows[0][0].ToString();
            txtIpone.Text = dt.Rows[0][1].ToString();
            dateBirth.Value = Convert.ToDateTime(dt.Rows[0][2]);
            txtSex.Text = dt.Rows[0][3].ToString();
            txtName.Text = dt.Rows[0][4].ToString();
            txtMoney.Text = dt.Rows[0][5].ToString();
            txtaddress.Text = dt.Rows[0][6].ToString();
            dateDay.Value = Convert.ToDateTime(dt.Rows[0][9]);
            txtIn.Text = dt.Rows[0][10].ToString();
        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void label10_Click(object sender, EventArgs e)
        {

        }

        private void label9_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void btnok_Click(object sender, EventArgs e)
        {
            DB.GetCn();
            string str = "update employee set employee_name='"
                + txtName.Text + "',employee_sex='"
                + txtSex.Text + "',employee_home='"
                + txtaddress.Text + "',employee_birth='"
                + dateBirth.Value + "',employee_ipone='" 
                + Convert.ToInt32(txtIpone.Text) + "',employee_introduct='"
                + txtIn.Text + "',employee_day='" 
                + dateDay.Value + "',employee_money='"
                + Convert.ToInt32(txtMoney.Text) + "'  where employee_id='" 
                + Convert.ToInt32(txtId.Text) + "'";
            DB.sqlEx(str);
            MessageBox.Show("修改成功");
        }

        private void btnclose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
